package com.zx.ishopping.controller.User;

import com.zx.ishopping.DTO.GetOrderListDTO;
import com.zx.ishopping.VO.OrderVo;
import com.zx.ishopping.results.Result;
import com.zx.ishopping.services.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController("UserOrderController")
@RequestMapping("/user/order")
public class OrderController {

    
    @Autowired
    private OrderService orderService;

    /**
     * 获取不同状态下的订单状态
     * @param 
     * @return
     */
    @GetMapping("/getOrderList")
    public Result<List<OrderVo>> getOrderList( GetOrderListDTO getOrderListDTO){
        List<OrderVo> orderList = orderService.getOrderList(getOrderListDTO);
        return Result.success(orderList);
    }

    /**
     * 用户下单选择收获地址下单
     */
    @PostMapping("/addOrder")
    public Result addOrder(Long addressId){
         orderService.addOrder(addressId);
        return Result.success();
    }
    



}
